#ifndef __UART_DEVICE_H
#define __UART_DEVICE_H


struct uart_device{
    char * name;
    int (*init) (struct uart_device *pDev, int baud, int data_bits, int stop_bits, int parity);
    int (*send) (struct uart_device *pDev, unsigned char * data, int length, int timeout);
    int (*recv) (struct uart_device *pDev, unsigned char * data, int timeout);
    void *priv_data;
};

struct priv_struct{
    int usart_handler;  // usart handler
    // semaphore for send and recv
    sem_t send_sem;
    sem_t recv_sem;
    // queue for send and recv
    queue_t send_queue;
    queue_t recv_queue;
};

struct uart_device * find_uart_device(char * name);

#endif
